#!/bin/env python
# -*- coding: utf-8 -*-
########################################
#Author:qingbo.song                    #
#Date:2015.09.22                       #
#E-mail:qingbo.song@apicloud.com       #
#Comment: Denyhosts_install.py         #
#Path: /usr/local/src/                 #
#Version:V 1.0                         #
########################################

'''
	Denyhosts_install to sshd IP hosts.deny 
'''
import os

os.system("wget -P /usr/local/src http://skylineservers.dl.sourceforge.net/project/denyhosts/denyhosts/2.6/DenyHosts-2.6.tar.gz")
os.system("cd /usr/local/src && tar xf DenyHosts-2.6.tar.gz && cd DenyHosts-2.6")
os.system("python setup.py install && cp /usr/local/src/DenyHosts-2.6/denyhosts.py /usr/bin/denyhosts.py")
os.system("cp /usr/local/src/denyhosts.cfg /usr/share/denyhosts/denyhosts.cfg && mkdir -p /usr/share/denyhosts/data && cd /usr/share/denyhosts/ && cp daemon-control-dist /etc/init.d/denyhosts")